import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DefaultConfig implements Serializable {


    private static final long serialVersionUID = 4778302979807302453L;

    private Integer small;

    private Integer big;

    private String likeName;

    private Map<String,String > refConfig;

    public DefaultConfig(Integer small, Integer big, String likeName, Map<String, String> refConfig) {
        this.small = small;
        this.big = big;
        this.likeName = likeName;
        this.refConfig = refConfig;
    }

    public DefaultConfig(String likeName, Map<String, String> refConfig) {
        this.likeName = likeName;
        this.refConfig = refConfig;
    }

    public DefaultConfig() {
    }


    public Integer getSmall() {
        return small;
    }

    public void setSmall(Integer small) {
        this.small = small;
    }

    public Integer getBig() {
        return big;
    }

    public void setBig(Integer big) {
        this.big = big;
    }

    public String getLikeName() {
        return likeName;
    }

    public void setLikeName(String likeName) {
        this.likeName = likeName;
    }

    public Map<String, String> getRefConfig() {
        return refConfig;
    }

    public void setRefConfig(Map<String, String> refConfig) {
        this.refConfig = refConfig;
    }

    public static void main(String[] args) throws Exception {
// htmlType   input,textarea,select,checkbox,radio,datetime,image,upload,editor
// queryType    EQ,NE,GT,LT,LIKE,BETWEEN
//content
        ObjectMapper obj = new ObjectMapper();
        Map<String,String > rc=new HashMap<>();
        rc.put("htmlType","input");
        rc.put("queryType","LIKE");
        List<DefaultConfig> list = new ArrayList<>();
        list.add(new DefaultConfig(0,200,"name",rc));
        Map<String,String > rc2=new HashMap<>();
        rc2.put("htmlType","upload");
        list.add(new DefaultConfig(0,200,"file",rc2));
        Map<String,String > rc3=new HashMap<>();
        rc3.put("htmlType","image");
        list.add(new DefaultConfig(0,200,"img,image,pic,picture",rc3));
        Map<String,String > rc4=new HashMap<>();
        rc4.put("htmlType","textarea");
        list.add(new DefaultConfig(201,400,"remark",rc4));
        Map<String,String > rc5=new HashMap<>();
        rc5.put("htmlType","select");
        rc5.put("queryType","EQ");
        list.add(new DefaultConfig(0,60,"type,flag,group,code,status",rc5));
        Map<String,String > rc6=new HashMap<>();
        rc6.put("htmlType","editor");
        list.add(new DefaultConfig(200,1000,"content",rc6));
        String json =  obj.writeValueAsString(list);
        System.out.println(json);
        Map<String,String > rcc=new HashMap<>();
        rcc.put("htmlType","editor");

        List<DefaultConfig> list2 = new ArrayList<>();
        list2.add(new DefaultConfig("content",rcc));
        json =  obj.writeValueAsString(list2);
        System.out.println(json);

        Map<String,String > rccc=new HashMap<>();
        rccc.put("htmlType","editor");
        rccc.put("queryType","EQ");
        List<DefaultConfig> list3 = new ArrayList<>();
        list3.add(new DefaultConfig("status,flag,type",rccc));
        json =  obj.writeValueAsString(list3);
        System.out.println(json);

        Map<String,String > rcccb=new HashMap<>();
        rcccb.put("htmlType","datetime");
        rcccb.put("queryType","BETWEEN");
        List<DefaultConfig> list4 = new ArrayList<>();
        list4.add(new DefaultConfig("day,time",rcccb));
        json =  obj.writeValueAsString(list4);
        System.out.println(json);
    }
}
